<HTML><HEAD><TITLE>nth0(?I, ?List, -Elem, -Rest)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(listut)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>nth0(?I, ?List, -Elem, -Rest)</H1>
Access nth element and remainder of a list
<DL>
<DT><EM>I</EM></DT>
<DD>Integer position index, counting from 0
</DD>
<DT><EM>List</EM></DT>
<DD>A list
</DD>
<DT><EM>Elem</EM></DT>
<DD>Any term
</DD>
<DT><EM>Rest</EM></DT>
<DD>A list
</DD>
</DL>
<H2>Description</H2>
	Unifies Elem with the Nth element of List, counting from 0,
	and Rest with the other elements.  It can be used to select
	the Nth (counting from 0) element of List (yielding Elem and
	Rest), or to insert Elem after the Nth (counting from 1)
	element of Rest, when it yields List, e.g. nth0(2, List, c,
	[a,b,d,e]) unifies List with [a,b,c,d,e].
    
<H3>Modes and Determinism</H3><UL>
<LI>nth0(+, +, -, -) is det
<LI>nth0(-, +, -, -) is nondet
<LI>nth0(-, -, -, -) is nondet
</UL>
<H2>See Also</H2>
<A HREF="../../lib_public/listut/nth0-3.html">nth0 / 3</A>, <A HREF="../../lib_public/listut/nth1-3.html">nth1 / 3</A>, <A HREF="../../lib_public/listut/nth1-4.html">nth1 / 4</A>
</BODY></HTML>
